import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:osc/models/entity/osc_medal_entity.dart';
import 'package:osc/res/dimens.dart';
import 'package:osc/ui/pages/common_page.dart';
import 'package:osc/ui/widgets/image_loader.dart';
import 'package:osc/ui/widgets/small_widgets.dart';
import 'package:osc/utils/pd_util.dart';

class MedalPage extends StatelessWidget {
  final OscMedal medal;
  const MedalPage({Key key, @required this.medal}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return CommonPage(
        title: "勋章详情",
        body: buildBody(),
    );
  }

  buildBody(){
    return Container(
      padding: EdgeInsets.only(top: Dimens.gap_activity_vertical, left: Dimens.gap_activity_horizontal, right: Dimens.gap_activity_horizontal, bottom: Dimens.gap_view_normal),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        mainAxisSize: MainAxisSize.max,
        children: <Widget>[
          Container(
            margin: EdgeInsets.symmetric(horizontal: Dimens.gap_activity_horizontal),
            padding: EdgeInsets.symmetric(horizontal: Dimens.gap_activity_vertical, vertical: Dimens.gap_activity_vertical),
            child: Column(
              children: <Widget>[
                ImageLoader(url: medal.applyStatus == 2? medal.lightLargeLogo : medal.grayLargeLogo),
                SmallWidgets.buildLine(color: Colors.transparent, height: Dimens.gap_activity_vertical),
                SmallWidgets.buildText(medal.intro, Colors.black, Dimens.font_sp14, textAlign: TextAlign.center),
              ],
            ),
          ),
          Expanded(child: Text("")),
          SmallWidgets.buildText("领取条件", Colors.black38, Dimens.font_sp12),
          SmallWidgets.buildText(medal.obtainCondition, Colors.black87, Dimens.font_sp14),
          SmallWidgets.buildLine(color: Colors.transparent, height: Dimens.gap_activity_vertical),
          Row(
            children: <Widget>[
              Expanded(
                child: RaisedButton(
                  color: Colors.green,
                  onPressed: (){
                    PdUtil.showToast(msg: "暂未开放");
                  },
                  child: SmallWidgets.buildText("立即分享", Colors.white, Dimens.font_sp12),
                ),
              )
            ],
          ),
        ],
      ),
    );
  }
}
